package com.meet.controller;

import com.meet.bizservice.ActivityService;
import com.meet.util.Result;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/search")
@CrossOrigin
@Validated
public class MeetSearchController {

    @Autowired
    private ActivityService activityService;

    @GetMapping("/activities")
    public Result<?> searchActivities(@ModelAttribute @Validated SearchRequest request) {
        // 这里应该实现搜索逻辑，为简化演示直接返回示例数据
        return activityService.getActivities(1, 10, request.getLocation(), request.getCategory(), null, request.getKeyword());
    }

    // Request DTO
    @Data
    public class SearchRequest {
        private String keyword;
        private String category;
        private String location;

        // Getters and Setters
        public String getKeyword() {
            return keyword;
        }

        public void setKeyword(String keyword) {
            this.keyword = keyword;
        }

        public String getCategory() {
            return category;
        }

        public void setCategory(String category) {
            this.category = category;
        }

        public String getLocation() {
            return location;
        }

        public void setLocation(String location) {
            this.location = location;
        }
    }
}
